<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
----	(c) Copyright 2002-2011 by Lutz Sammer, Russell Smith

----    This program is free software; you can redistribute it and/or modify
----    it under the terms of the GNU General Public License as published by
----    the Free Software Foundation; only version 2 of the License.
----
----    This program is distributed in the hope that it will be useful,
----    but WITHOUT ANY WARRANTY; without even the implied warranty of
----    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
----    GNU General Public License for more details.
----
----    You should have received a copy of the GNU General Public License
----    along with this program; if not, write to the Free Software
----    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
----    02110-1301, USA.
-->
    <title>Stratagus Configuration Language Description: Icon</title>
    <meta name="Author" content="johns98@gmx.net">
    <meta name="Keyword" content="ccl,tileset">
    <meta name="Description" content="">
</head>
<body>
<pre width=80>
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
           Stratagus - A free fantasy real time strategy game engine
</pre>
<hr>
<h1>Stratagus Configuration Language Description: Research</h1>
<hr>
<a href="../index.html">Stratagus</a>
<a href="../faq.html">FAQ</a>
<a href="mapsetup.html">PREV</a>
<a href="savegame.html">NEXT</a>
<a href="index.html">LUA Index</a>
<hr>
<a href="#CheckDependency">CheckDependency</a>
<a href="#DefineAllow">DefineAllow</a>
<a href="#DefineDependency">DefineDependency</a>
<a href="#DefineModifier">DefineModifier</a>
<a href="#GetDependency">GetDependency</a>
<hr>
<h2>Intro - Introduction to research functions and variables</h2>

Everything around researching and upgrades.
<h2>Functions</h2>

<a name="CheckDependency"></a>
<h3>CheckDependency(player, object)</h3>
Checks if dependencies are met. Returns true if the dependencies are met.

<dl>
 <dt>player</dt><dd>Player</dd>
 <dt>object</dt><dd>The object which we want to check the dependencies of.</dd>
</dl>

<h4>Example</h4>
<pre>
    CheckDependency(AiPlayer(), "upgrade-dwarves-level2")
</pre>

<a name="DefineUnitAllow"></a>
<h3>DefineUnitAllow(name, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N)</h3>

Define how many units of a given type each player can have.

<dl>
<dt>name</dt>
<dd>Name of an unit-type to be defined.
</dd>
<dt>N</dt>
<dd>
  The initial quantity of units per type at level start.
  Each player has his quatinty, the first is for player 0 and the last
  is for player 15.
</dd>
</dl>

<h4>Example</h4>

<pre>
    -- Allow 1 catapult for the 2nd player.
    DefineUnitAllow("unit-catapult", 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
</pre>


<a name="DefineAllow"></a>
<h3>DefineAllow(name, str16)</h3>

Define what upgrades are enabled for each player during
a level.

<dl>
<dt>name</dt>
<dd>Name of an upgrade to be defined.
</dd>
<dt>str16</dt>
<dd>
  The initial allow state for the upgrade at level start:
  <ul>
  <li>A - Allowed
  <li>E - Enabled, allowed by level but currently forbidden
  <li>F - Forbidden
  <li>R - Researched or acquired
  <li>Q - Acquired but currently forbidden (does it make sense?:)
  </ul>
  Each player has his own character, the first is for player 0 and the last
  is for player 15.
</dd>
</dl>

<h4>Example</h4>

<pre>
    -- Allow the metal upgrade for all 16 players.
    DefineAllow("upgrade-metal", "AAAAAAAAAAAAAAAA")
    --                            ^- player 0    ^- player 15
</pre>



<a name="DefineDependency"></a>
<h3>DefineDependency( unit-type/upgrade ...)</h3>

Define the dependencies for an unit-type or an upgrade. The dependency
must be full filled before an unit or research can be used.
<p>
<code>DefineDependency unit-type/upgrade '( required-part )
     ['or '( optional-or-part ) ...] )
</code>

<dl>
<dt>required-part</dt>
<dd><code>unit/upgrade [count]</code><p>
   A list of unit-types or upgrades required.
   <dl>
   <dt>unit/upgrade</dt>
   <dd>Unit-type name or upgrade name required.
   </dd>
   <dt>count</dt>
   <dd>Optional count, how many units of the unit-type are required.
   </dl>
</dd>
<dt>'or optional-or-part</dt>
<dd><code>unit/upgrade [count]</code><p>
    Optional list of or parts. One or list must be complete full filled.<p>
   <dl>
   <dt>unit/upgrade</dt>
   <dd>Unit-type name or upgrade name required.
   </dd>
   <dt>count</dt>
   <dd>Optional count, how many units of the unit-type are required.
   </dl>
</dd>
</dl>

<h4>Example</h4>

<pre>
    -- The second sword upgrade is only possible, if the first sword upgrade is
    -- researched.
    (define-dependency "upgrade-sword2" '(upgrade-sword1))
    -- The ranger upgrade is only available if a keep or castle is available.
    (define-dependency 'upgrade-ranger '(unit-keep) 'or '(unit-castle))
</pre>

<a name="DefineModifier"></a>
<h3>DefineModifier("upgrade-name", {effect1, effect1-arg}, {effect2, effect2-arg}, ... )</h3>

Define the effects (modifier) of an upgrade. An upgrade can have multiple
modifiers. It can activate, enable or disable other upgrades and allows
complex reactions.

<dl>
<dt>"upgrade-name"</dt>
<dd>Name of the upgrade, which has this effects. All effects change
all old units and any new unit of a player.
</dd>
<dt>{effectN, effectN-arg}</dt>
<dd>A list of effects of the upgrade. Here are all possible effects:
  <dl>
  <dt>{"attack-range", N}</dt>
  <dd>Increase the attack range of all units of the unit-types given with
  '(apply-to ...). Note it can be increased with positive numbers and decreased
  with negative numbers.
  </dd>
  <dt>{"sight-range", N}</dt>
  <dd>Increase the sight range of all units of the unit-types given with
  '(apply-to ...).
  </dd>
  <dt>{"basic-damage", N}</dt>
  <dd>Increase the basic damage of all units of the unit-types given with
  '(apply-to ...).
  </dd>
  <dt>{"piercing-damage", N}</dt>
  <dd>Increase the piercing damage of all units of the unit-types given with
  '(apply-to ...).
  </dd>
  <dt>{"armor", N}</dt>
  <dd>Increase the armor of all units of the unit-types given with
  '(apply-to ...).
  </dd>
  <dt>{"hit-points", N}</dt>
  <dd>Increase the hit points of all units of the unit-types given with
  '(apply-to ...).
  </dd>
  <dt>{"regeneration-rate", N}</dt>
  <dd>Increase the amount of HP a unit gains per seconds</dt>
  <dt>{"variable-name", N}</dt>
  <dd>Increase the user defined variable of all units of the unit-types given with
  '(apply-to ...). Note Variable must be defined with DefineVariables().
  </dd>
  <dt>{"cost", ("resource-name", N}}</dt>
  <dd>Increase the costs for the resource type of all unit-types
  or upgrade-ids given with '(apply-to ...).
  </dd>
  <dt>{"allow-unit", "unit-type", N}</dt>
  <dd>
      Change the state of an upgrade. N is the maximum quantity
      of this unit per player.
  </dd>
  <dt>{"allow", "upgrade", 'A' or 'E' or 'F' or 'R' or 'Q'}</dt>
  <dd>Change the state of an upgrade. state can be
      <ul>
      <li>A - Allowed
      <li>E - Enabled, allowed by level but currently forbidden
      <li>F - Forbidden
      <li>R - Researched or acquired
      <li>Q - Acquired but currently forbidden (does it make sense?:)
      </ul>
      FIXME: The correct possible changed must be described.
  </dd>
  <dt>{"apply-to", "unit-type" or "upgrade"}</dt>
  <dd>The modifiers are applied to this unit-type or upgrade.</dd>
  <dt>{"convert-to", "unit-type"}</dt>
  <dd>All units of the unit-types given with '(apply-to ...) are converted
  into this unit-type.
  </dd>
  </dl>
</dd>
</dl>

<h4>Example</h4>

<pre>
-- This is the default effect of the first sword upgrade. The piercing damage
-- of the listed units is increased.
DefineModifier("upgrade-sword1",
  {"piercing-damage", 2},
  {"apply-to", "unit-footman"}, {"apply-to", "unit-knight"}, {"apply-to", "unit-paladin"},
  {"apply-to", "unit-dwarves"}, {"apply-to", "unit-arthor-literios"}, {"apply-to", "unit-wise-man"},
  {"apply-to", "unit-man-of-light"}, {"apply-to", "unit-knight-rider"})
</pre>

<a name="GetDependency"></a>
<h3>GetDependency()</h3>

NOT WRITTEN YET.

<h4>Example</h4>

<pre>
    GetDependency()
</pre>

<hr>
(C) Copyright 2002-2015 by The <a href="https://launchpad.net/stratagus">Stratagus</a> Project under the <a href="../gpl.html">GNU General Public License</a>.<br>
All trademarks and copyrights on this page are owned by their respective owners.<br>
</body>
</html>
